knitr::opts_chunk$set(fig.width=5, fig.height=5) 

rm(list=ls())


options(scipen=999)

pkgs <- c("dplyr", "ggplot2", "stargazer", "car", "tidyverse", "extrafont", "plyr", "haven", "coefplot", "plotrix", "sensemakr")
# A function to load all above packages. Install if they have not been installed.
usePackage <- function(p){
  for (pkg in p){
    if (!is.element(pkg, installed.packages()[,1]))
      install.packages(pkg, dep = TRUE, repos = "https://cloud.r-project.org/")
    require(pkg, character.only = TRUE)
  }
}
usePackage(pkgs)


d <- as.data.frame(read.csv("cesdata.csv"))



## Issue 1 = border wall (Trump wants / exec order) DKA109 (Trump) / DKA101 (Biden)

d$TrumpBorderWall <- as.numeric(d$DKA109)
d$BidenBorderWall <- as.numeric(d$DKA101)
d$MarginalBorderWall <- abs(d$TrumpBorderWall - d$BidenBorderWall)

summary(d$TrumpBorderWall)
summary(d$BidenBorderWall)
summary(d$MarginalBorderWall)

## 2 = abortion ban federal (Trump Wants / legislation + const) DKA110 (Trump) / DKA102 (Biden)

d$TrumpAbortionBan <- as.numeric(d$DKA110)
d$BidenAbortionBan <- as.numeric(d$DKA102)
d$MarginalAbortionBan <- abs(d$TrumpAbortionBan - d$BidenAbortionBan)

summary(d$TrumpAbortionBan)
summary(d$BidenAbortionBan)
summary(d$MarginalAbortionBan)

## 3 = Min wage 15 federal (Biden wants / legislation) DKA111 (Trump) / DKA103 (Biden)

d$TrumpMinWage15 <- as.numeric(d$DKA111)
d$BidenMinWage15 <- as.numeric(d$DKA103)
d$MarginalMinWage15 <- abs(d$BidenMinWage15 - d$TrumpMinWage15)

summary(d$TrumpMinWage15)
summary(d$BidenMinWage15)
summary(d$MarginalMinWage15)

## 4 = Federal prayer in school (Trump wants / legislation + const) DKA112 (Trump) / DKA104 (Biden)

d$TrumpFederalPrayer <- as.numeric(d$DKA112)
d$BidenFederalPrayer <- as.numeric(d$DKA104)
d$MarginalFederalPrayer <- abs(d$TrumpFederalPrayer - d$BidenFederalPrayer)


summary(d$TrumpFederalPrayer)
summary(d$BidenFederalPrayer)
summary(d$MarginalFederalPrayer)

## 5 = Refugees up (Biden wants / executive order) DKA113 (Trump) / DKA105 (Biden)

d$TrumpRefugeesUp <- as.numeric(d$DKA113)
d$BidenRefugeesUp <- as.numeric(d$DKA105)
d$MarginalRefugeesUp <- abs(d$BidenRefugeesUp - d$TrumpRefugeesUp)

summary(d$TrumpRefugeesUp)
summary(d$BidenRefugeesUp)
summary(d$MarginalRefugeesUp)

## 6 = Medicare for all (Biden wants / legislation) DKA114 (Trump) / DKA106 (biden)

d$TrumpMedicareAll <- as.numeric(d$DKA114)
d$BidenMedicareAll <- as.numeric(d$DKA106)
d$MarginalMedicareAll <- abs(d$BidenMedicareAll - d$TrumpMedicareAll)

summary(d$TrumpMedicareAll)
summary(d$BidenMedicareAll)
summary(d$MarginalMedicareAll)

## 7 = Ban on police military equipment (Biden wants / executive order) DKA115 (Trump) / DKA107 (Biden)

d$TrumpBanPoliceMil <- as.numeric(d$DKA115)
d$BidenBanPoliceMil <- as.numeric(d$DKA107)
d$MarginalPoliceMil <- abs(d$BidenBanPoliceMil - d$TrumpBanPoliceMil)

summary(d$TrumpBanPoliceMil)
summary(d$BidenBanPoliceMil)
summary(d$MarginalPoliceMil)

## 8 = Paris deal withdrawal (Trump wants / executive order) DKA116 (Trump) / DKA108 (Biden)

d$TrumpParisWithdraw <- as.numeric(d$DKA116)
d$BidenParisWithdraw <- as.numeric(d$DKA108)
d$MarginalParisWithdraw <- abs(d$TrumpParisWithdraw - d$BidenParisWithdraw)

summary(d$TrumpParisWithdraw)
summary(d$BidenParisWithdraw)
summary(d$MarginalParisWithdraw)


### ADDITIONAL VARIABLES


d$Democrat <- ifelse(d$pid3 == 1, 1, 0)
d$Republican <- ifelse(d$pid3 == 2, 1, 0)

d$Partisanship <-as.factor(ifelse(d$pid3 == 1, "Democrat", ifelse(d$pid3 == 2, "Republican", "NA")))
d$Partisanship <- relevel(d$Partisanship, ref= "Democrat")

d$SelfReportedVote <- ifelse(d$CC20_401 == 5, 1, 0)
d$ValidatedVote <- as.factor(ifelse(is.na(d$CL_2020gvm),0, 1))

## Strong Partisan

d$StrongPartisan <- ifelse(d$pid7 == 1 | d$pid7 == 7, 1, 0)
StrongPartisan <- d$StrongPartisan

d$LeanDemocrat <- ifelse( d$pid7 == 2 | d$pid7 == 3, 1, 0)
d$LeanRepublican <- ifelse(d$pid7 == 6 | d$pid7 == 5, 1, 0)

d$LeanPartisan <- ifelse(d$LeanDemocrat ==1 | d$LeanRepublican == 1, 1, 0)

d$StrongDemocrat <- ifelse(d$pid7 == 1, 1, 0)
d$StrongRepublican <- ifelse(d$pid7 == 7, 1, 0)

## Ideology

d$Liberal <- ifelse(d$ideo5 == 1 | d$ideo5 == 2, 1, 0)
d$Conservative <- ifelse(d$ideo5 == 4 | d$ideo5 == 5, 1, 0)
d$Ideologue <- ifelse(d$Liberal == 1 | d$Conservative == 1, 1, 0)


## LOCAL NEWS ONLY

d$LocalNews0 <- as.numeric(ifelse(d$CC20_300a == 1, 1, 0))
d$LocalNews <- ifelse(d$LocalNews0 %in% NA, 0, d$LocalNews0)


# NATIONAL NEWS ONLY

d$NationalNews0 <- ifelse(d$CC20_300a == 2, 1, 0)
d$NationalNews <- ifelse(d$NationalNews0 %in% NA, 0, d$NationalNews0)


## Both News


d$TVNews0 <- ifelse(d$CC20_300a == 3, 1, 0)
d$TVNews <- ifelse(d$TVNews0 %in% NA, 0, d$TVNews0)



## Education

summary(d$educ)

d$Education <- d$educ /6

## AGE

d$Age <- 2021 - d$birthyr 
#summary(d$Age)
d$AgeScaled <- d$Age/92


## Gender 

d$Female <- ifelse(d$gender == 2, 1, 0)


## Knows Party in US HOUSE and SENATE

d$KnowHouse <- ifelse(d$CC20_310a == 2, 1, 0)
d$KnowSenate <- ifelse(d$CC20_310b == 1, 1, 0)

d$PoliticalKnowledge <- (d$KnowHouse + d$KnowSenate)/2


## Race
d$White <- ifelse(d$race == 1, 1, 0)
d$Black <- ifelse(d$race == 2, 1, 0)
d$Hispanic <- ifelse(d$race == 3, 1, 0)
d$Asian <- ifelse(d$race == 4, 1, 0)

## State

d$State <- as.factor(d$inputstate)

## Political interest
d$Interest <- as.factor(ifelse(d$newsint >7, "NA", d$newsint))

d$Interest0<-ifelse(d$Interest == 4, 0, d$Interest)
d$Interest1<-ifelse(d$Interest == 3, .33, d$Interest0)
d$Interest2<-ifelse(d$Interest == 2, .66, d$Interest1)
d$Interest3<-ifelse(d$Interest == 1, 1, d$Interest2)
d$Interest4<-as.numeric(ifelse(d$Interest == 7, "NA", d$Interest3))
d$PoliticalInterest <- d$Interest4

## IDEOLOGY

d$Ideology <- as.numeric(ifelse(d$CC20_340a == 8 , "NA",  d$CC20_340a -4))

## Marital status

d$Married <- ifelse(d$marstat == 1, 1, 0)

## Citizen

d$Citizen <- ifelse(d$cit1 == 1, 1, 0)

## OwnHome

d$OwnHome <- ifelse(d$ownhome == 1, 1, 0)

## Income

d$Income <- as.numeric(ifelse(d$faminc_new == 97,  "NA", d$faminc_new))
d$IncomeScaled <- d$Income/16


## Union member

d$Union <- ifelse(d$union == 1 , 1, 0)

## Past voter

d$PastVoter <- ifelse(d$presvote16post == 7, 0, 1)

## Unemployed

d$Unemployed <- ifelse(d$employ == 4, 1, 0)


## Expected policy gap

d$ExpectedPolicyGap <- (d$MarginalAbortionBan + d$MarginalFederalPrayer + d$MarginalBorderWall + d$MarginalParisWithdraw + d$MarginalMinWage15 + d$MarginalMedicareAll + d$MarginalRefugeesUp + d$MarginalPoliceMil)/8/100


d$MarginalLegislation <- (d$MarginalAbortionBan + d$MarginalFederalPrayer + d$MarginalMinWage15 + d$MarginalMedicareAll)/4/100
d$MarginalExecOrder <- (d$MarginalBorderWall + d$MarginalParisWithdraw + d$MarginalRefugeesUp + d$MarginalPoliceMil)/4/100

## Validated vote


ValidatedVote <- as.numeric(d$ValidatedVote)
d$ValidatedVote3 <- ifelse(as.numeric(d$ValidatedVote) == 2, 1, 0)

## Demos table

#stargazer(subset(d, select=c("Liberal", "Conservative", "White","Black", "Asian", "Hispanic", "Female", "LeanDemocrat", "StrongDemocrat", "LeanRepublican", "StrongRepublican", "PoliticalKnowledge" , "PoliticalInterest", "Education", "Income", "Age")), digits = 2)



##Models



## BASIC MODEL

BasicModelW <- lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap, weights = teamweight, data = d)
BasicModel <- lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap, data = d)

## SELF REPORTED BASIC MODEL

SelfBasicModelW <- lm(as.numeric(d$SelfReportedVote) ~ ExpectedPolicyGap, weights = teamweight, data = d)
SelfBasicModel <- lm(as.numeric(d$SelfReportedVote) ~ ExpectedPolicyGap, data = d)

## MAIN MODEL

MainModelW<-lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap + StrongPartisan  +Liberal + Conservative +  LeanPartisan + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter , weights = d$teamweight, data = d) 

MainModelNoW <-lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap + StrongPartisan + Liberal + Conservative + LeanPartisan + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, data = d) 

## Democrat / Republican MAIN MODEL

DRMainModelW<-lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap + LeanDemocrat + StrongDemocrat + LeanRepublican + StrongRepublican  + Liberal + Conservative + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, weights = d$teamweight, data = d) 

DRMainModelNoW<-lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap + LeanDemocrat + StrongDemocrat + LeanRepublican + StrongRepublican + Liberal + Conservative  + PoliticalInterest + Liberal + Conservative+ Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, data = d) 

## Self reported main model

SelfMainModelW <-  lm(as.numeric(d$SelfReportedVote) ~ ExpectedPolicyGap + StrongPartisan + LeanPartisan + Liberal + Conservative + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, weights = d$teamweight, data = d) 

SelfMainModelNoW <-  lm(as.numeric(d$SelfReportedVote) ~ ExpectedPolicyGap + StrongPartisan + LeanPartisan  + Liberal + Conservative + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, data = d) 

## STATE FIXED EFFECTS

StateMainModelW <-lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap + StrongPartisan + LeanPartisan + Liberal + Conservative+ PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter + State , weights = d$teamweight, data = d) 

StateMainModelNoW <-lm(as.numeric(d$ValidatedVote3) ~ ExpectedPolicyGap + StrongPartisan + LeanPartisan +   Liberal + Conservative+ PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter + State, data = d) 




##Main plots



d$ValidatedVote2 <- ifelse(d$ValidatedVote == 1, "Yes", "No")

summarySE <- function(data=NULL, measurevar, groupvars=NULL, na.rm=FALSE,
                      conf.interval=.95, .drop=TRUE) {
  library(plyr)
  
  # New version of length which can handle NA's: if na.rm==T, don't count them
  length2 <- function (x, na.rm=FALSE) {
    if (na.rm) sum(!is.na(x))
    else       length(x)
  }
  
  # This does the summary. For each group's data frame, return a vector with
  # N, mean, and sd
  datac <- ddply(data, groupvars, .drop=.drop,
                 .fun = function(xx, col) {
                   c(N    = length2(xx[[col]], na.rm=na.rm),
                     mean = mean   (xx[[col]], na.rm=na.rm),
                     sd   = sd     (xx[[col]], na.rm=na.rm)
                   )
                 },
                 measurevar
  )
  
  # Rename the "mean" column    
  datac <- rename(datac, c("mean" = measurevar))
  
  datac$se <- datac$sd / sqrt(datac$N)  # Calculate standard error of the mean
  
  # Confidence interval multiplier for standard error
  # Calculate t-statistic for confidence interval: 
  # e.g., if conf.interval is .95, use .975 (above/below), and use df=N-1
  ciMult <- qt(conf.interval/2 + .5, datac$N-1)
  datac$ci <- datac$se * ciMult
  
  return(datac)
}

tgc <-summarySE(d, measurevar="ExpectedPolicyGap", groupvars=c("ValidatedVote2"))


simpleplot <- ggplot(tgc, aes(x=ValidatedVote2, y=ExpectedPolicyGap)) + geom_line() +  geom_point(size=3) + geom_errorbar(aes(ymin=ExpectedPolicyGap-ci, ymax=ExpectedPolicyGap+ci), colour="black", width=.1)  +  theme(text = element_text(size=10, family="LM Roman 10")) + labs(title = "Difference in expected policy gap \n between voters and non-voters" , x= "Validated voter", y = "Expected policy gap") +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) + theme(plot.title = element_text(hjust = 0.5)) +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black")) + theme(legend.position = "bottom")+ scale_color_grey()+ scale_y_continuous( labels = scales::percent_format(accuracy = 1),  limits =  c(0, 1))

ggsave(filename="figure1.jpeg", plot=simpleplot, device="jpeg", height=5, width=5, units="in", dpi=1000)




mainplot <-coefplot(MainModelW,  coefficients=c('Liberal', 'Conservative','StrongPartisan', 'LeanPartisan',  'PoliticalInterest', 'Education', 'PoliticalKnowledge', 'PastVoter', 'ExpectedPolicyGap') , newNames =c('ExpectedPolicyGap'='Expected policy gap', 'StrongPartisan' = 'Strong partisan', 'LeanPartisan' = 'Leaner / weak partisan', 'PoliticalInterest' = 'Interest in politics', 'PoliticalKnowledge' = 'Political knowledge', 'PastVoter' = 'Voted in 2016'), color = "black", zeroColor = "black", fillColor = "black",intercept = F, title ="") + scale_color_manual(values=c("black","grey")) + theme( axis.line.y = element_blank(), axis.ticks.y=element_blank())+   theme(text         = element_text(size=10, family="LM Roman 10")) + labs(title = "Validated Vote" , x= "Percent increase in chance respondent voted", y = "")+  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +theme(plot.title = element_text(hjust = 0.5, family = "LM Roman 10"))  +theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank(), axis.line = element_line(colour = "black"))+ theme(legend.position = "none")  + scale_x_continuous(labels=scales::percent_format(accuracy = 2))
mainplot


ggsave(filename="figure2.jpeg", plot=mainplot, device="jpeg", height=5, width=5, units="in", dpi=1000)







## PREDICTORS OF HIGH EXPECTATIONS


ExpModControlsPID <-  lm(ExpectedPolicyGap ~  LeanDemocrat + StrongDemocrat + LeanRepublican + StrongRepublican + Liberal + Conservative+  LocalNews + NationalNews + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, weights = d$teamweight, data = d) 

ExpModControlsPIDNoW <-  lm(ExpectedPolicyGap ~ LeanDemocrat + StrongDemocrat + LeanRepublican + StrongRepublican  +  Liberal + Conservative+ LocalNews + NationalNews + PoliticalInterest + Education +  PoliticalKnowledge + Black + White + Hispanic + Asian + IncomeScaled  + AgeScaled + Female +Married +OwnHome + Unemployed + Union + PastVoter, data = d) 



##Sensitivity analysis


## efficacy


sensitivity <- sensemakr(model = MainModelW,
                         treatment = "ExpectedPolicyGap",
                         benchmark_covariates = "AgeScaled",
                         kd = 1:3)

sensitivity2 <- sensemakr(model = MainModelW,
                          treatment = "ExpectedPolicyGap",
                          benchmark_covariates = "PastVoter",
                          kd = 1:3)

ovb_minimal_reporting(sensitivity, format = "latex")

plot(sensitivity, sensitivity.of="t-val")

plot(sensitivity2, sensitivity.of="t-val")






###Expert data

e <- read.csv("expertdata.csv")


## Trump wants = 1, 2, 4, 8
## Biden wants = 3, 5, 6, 7

## All marginals = Trump - Biden

## Issue 1 = border wall (Trump wants / exec order)

e$TrumpBorderWall <- as.numeric(e$Trump_1)
e$BidenBorderWall <- as.numeric(e$Biden_1)
e$MarginalBorderWall <- abs(e$TrumpBorderWall - e$BidenBorderWall)

#summary(e$MarginalBorderWall)

## 2 = abortion ban federal (Trump Wants / legislation + const)

e$TrumpAbortionBan <- as.numeric(e$Trump_2)
e$BidenAbortionBan <- as.numeric(e$Biden_2)
e$MarginalAbortionBan <- abs(e$TrumpAbortionBan - e$BidenAbortionBan)

#summary(e$MarginalAbortionBan)

## 3 = Min wage 15 federal (Biden wants / legislation)

e$TrumpMinWage15 <- as.numeric(e$Trump_3)
e$BidenMinWage15 <- as.numeric(e$Biden_3)
e$MarginalMinWage15 <- abs(e$TrumpMinWage15 - e$BidenMinWage15)

#summary(e$MarginalMinWage15)

## 4 = Federal prayer in school (Trump wants / legislation + const)

e$TrumpFederalPrayer <- as.numeric(e$Trump_4)
e$BidenFederalPrayer <- as.numeric(e$Biden_4)
e$MarginalFederalPrayer <- abs(e$TrumpFederalPrayer - e$BidenFederalPrayer)

#summary(e$MarginalFederalPrayer)

## 5 = Refugees up (Biden wants / executive order)

e$TrumpRefugeesUp <- as.numeric(e$Trump_5)
e$BidenRefugeesUp <- as.numeric(e$Biden_5)
e$MarginalRefugeesUp <- abs(e$TrumpRefugeesUp - e$BidenRefugeesUp)

#summary(e$MarginalRefugeesUp)

## 6 = Medicare for all (Biden wants / legislation)

e$TrumpMedicareAll <- as.numeric(e$Trump_6)
e$BidenMedicareAll <- as.numeric(e$Biden_6)
e$MarginalMedicareAll <- abs(e$TrumpMedicareAll - e$BidenMedicareAll)

#summary(e$MarginalMedicareAll)

## 7 = Ban on police military equipment (Biden wants / executive order)

e$TrumpBanPoliceMil <- as.numeric(e$Trump_7)
e$BidenBanPoliceMil <- as.numeric(e$Biden_7)
e$MarginalPoliceMil <- abs(e$TrumpBanPoliceMil - e$BidenBanPoliceMil)

#summary(e$MarginalPoliceMil)

## 8 = Paris deal withdrawal (Trump wants / executive order)

e$TrumpParisWithdraw <- as.numeric(e$Trump_8)
e$BidenParisWithdraw <- as.numeric(e$Biden_8)
e$MarginalParisWithdraw <- abs(e$TrumpParisWithdraw - e$BidenParisWithdraw)


##

e$MarginalAverage <- (e$MarginalAbortionBan + e$MarginalBorderWall + e$MarginalFederalPrayer+ e$MarginalMedicareAll + e$MarginalMinWage15 + e$MarginalParisWithdraw + e$MarginalPoliceMil + e$MarginalRefugeesUp)/8

e$MarginalLegislation <- (e$MarginalAbortionBan + e$MarginalFederalPrayer + e$MarginalMinWage15 + e$MarginalMedicareAll)/4/100
e$MarginalExecOrder <- (e$MarginalBorderWall + e$MarginalParisWithdraw + e$MarginalRefugeesUp + e$MarginalPoliceMil)/4/100


## Job

e$LadderFaculty <- as.factor(ifelse(e$Job == "Assistant / Associate / Full Professor", 1, 0))
e$AmericanPolitics <- as.factor(ifelse(e$Expertise == "American politics", 1, 0))
e$TTAmericanPolitics <- as.factor(ifelse(e$LadderFaculty == 1 & e$AmericanPolitics == 1, 1, 0))



e$TrumpLawAverage <- (e$TrumpAbortionBan + e$TrumpFederalPrayer)/2
e$BidenLawAverage <- (e$BidenMinWage15 + e$BidenMedicareAll)/2
e$TrumpOrderAverage <- (e$TrumpBorderWall + e$TrumpParisWithdraw)/2
e$BidenOrderAverage <- (e$BidenRefugeesUp + e$BidenBanPoliceMil)/2

e$LawAverage <- (e$TrumpLawAverage + e$BidenLawAverage)/2
e$OrderAverage <- (e$TrumpOrderAverage + e$BidenOrderAverage)/2


e2<- subset(e,e$AmericanPolitics == 1)
e3<- subset(e,e$LadderFaculty == 1)

t.test(d$MarginalAbortionBan, e2$MarginalAbortionBan)
t.test(d$MarginalBorderWall, e2$MarginalBorderWall)
t.test(d$MarginalFederalPrayer, e2$MarginalFederalPrayer)
t.test(d$MarginalMedicareAll, e2$MarginalMedicareAll)
t.test(d$MarginalMinWage15, e2$MarginalMinWage15)
t.test(d$MarginalParisWithdraw, e2$MarginalParisWithdraw)
t.test(d$MarginalPoliceMil, e2$MarginalPoliceMil)
t.test(d$MarginalRefugeesUp, e2$MarginalRefugeesUp)


t.test(d$ExpectedPolicyGap, e2$MarginalAverage)
t.test(d$MarginalLegislation, e2$MarginalLegislation)
t.test(d$MarginalExecOrder, e2$MarginalExecOrder)

